Page({
  data: {
    visitorList: [],
    // 定义枚举
    statusMsg: {
      0: '已失效',
      1: '生效中'
    },
    statusType: {
      0: 'cancel',
      1: 'success'
    }
  },
  goPassport(e) {
    // console.log(e)
    wx.navigateTo({
      url: '/visitor_pkg/pages/passport/index?id=' + e.mark.id,
    })
  },
  onShow() {
    this.getVisitorList()
  },
  // 获取访客列表
  async getVisitorList() {
    const res = await wx.http.get('/visitor', { current: 1, pageSize: 10 })
    // console.log(res, '获取访客列表')
    this.setData({
      visitorList: res.data.rows
    })
  }
})
